/**
 *dell
 */
'use strict';
const path = require('path');
let actionBase = path.join(__dirname, '../server/actions/costPlan/');

module.exports = async function (ctx) {
    let params = ctx.method === 'GET' ? ctx.query : ctx.request.fields;
    let { actionType, special } = params;
    try {
        if (!special) {
            let execute = require(path.join(actionBase, `${actionType}Action`));
            ctx.body = await execute(params);
        } else {
            ctx.body = { success: false, message: '未定义可调用函数' };
        }

    } catch (e) {
        ctx.body = { success: false, message: e.message };
    }

};
